<template>
  <div class="app-container">
    <div style="background-color: #fff;" class="border-radius">
      <div style="height: 7px;">

      </div>
      <div class="div-title" style="border-radius: 4px">
        <span>网站设置</span>
      </div>

      <el-form ref="form" :model="form" :rules="rules" label-width="300px" label-position="right">

        <el-form-item label="网站名称" prop="platformName" style="font-weight: 0">
          <el-input v-model="form.platformName" class="select-normal" placeholder="请输入店铺名称" clearable></el-input>
        </el-form-item>
        <el-form-item label="主营品类" prop="mainCategory">
          <el-select v-model="form.mainCategory" placeholder="请主营品类" clearable size="small" filterable
            class="select-normal">
            <el-option v-for="dict in codeOptions" :key="dict.dictLabel" :label="dict.dictLabel"
              :value="dict.dictLabel" />
          </el-select>
        </el-form-item>

        <el-form-item label="网站地址" prop="region">
          <el-cascader ref="cascaderAddr" v-model="form.region" :options="options" clearable filterable
            class="select-normal">
          </el-cascader>
        </el-form-item>



        <el-form-item label="联系电话" prop="servePhone">
          <el-input v-model="form.servePhone" placeholder="请输入商家电话" clearable maxlength="11" class="select-normal">
          </el-input>
        </el-form-item>
        <el-form-item label="注册积分" prop="registerJifen">
          <el-input v-model="form.registerJifen" placeholder="请输入注册赠送积分" clearable maxlength="5" class="select-normal" @input="form.registerJifen=form.registerJifen.replace(/^(0+)|[^\d]+/g, '')">
          </el-input>
        </el-form-item>
        <el-form-item label="邀请积分" prop="invitationJifen">
          <el-input v-model="form.invitationJifen" placeholder="请输入邀请赠送积分" clearable maxlength="5" class="select-normal" @input="form.invitationJifen=form.invitationJifen.replace(/^(0+)|[^\d]+/g, '')">
          </el-input>
        </el-form-item>

        <el-form-item label="详细地址" prop="platformAddress" width="400px">
          <el-input v-model="form.platformAddress" placeholder="请输入详细地址" clearable class="select-normal"
            style="width: 350px"></el-input>
        </el-form-item>

        <el-form-item label="网站logo" style="font-weight: 0;">
          <imageArray style="width:500px" :imageStr.sync="form.platformLogUrl" :key="form.platformLogUrl"
            :msg="'图片要求：宽高相等且等于400px，大小1M内。'" :limit="1"></imageArray>
        </el-form-item>
        <el-form-item label="备案编号" prop="platformRemark">
          <el-input :rows="1" type="textarea" placeholder="请输入备案编号" v-model="form.platformRemark" style="width: 350px">
          </el-input>
        </el-form-item>



        <el-form-item label="商品底图" prop="platformImage" v-if="0 > 1">
          <imageArray style="width:500px" :imageStr.sync="form.platformImage" :key="form.platformImage"
            :msg="'图片要求：宽500px,高400px，大小1M内。'" :limit="1"></imageArray>
        </el-form-item>

        <div class="div-title" style="border-radius: 4px;display: none;">
          <span>分享设置</span>
        </div>

        <el-form-item label="版权所有" prop="platformText">
          <el-input v-model="form.platformText" placeholder="请输入版权所有" clearable style="width: 554px;" />
        </el-form-item>
        <el-form-item label="店铺分享图片" prop="platformImage" style="display: none;">
          <imageArray style="width:500px" :imageStr.sync="form.platformImage" :key="form.platformImage"
            :msg="'图片要求：宽500px,高400px，大小1M内。'" :limit="1"></imageArray>
        </el-form-item>
        <el-form-item>
          <label>&nbsp;</label>
        </el-form-item>
        <el-form-item>
         <el-button type="primary" @click="submitForm" style="margin-top: 10px;margin-left: 45%;">保存</el-button>
        </el-form-item>
        <el-form-item>
          <label>&nbsp;</label>
        </el-form-item>


        <div class="div-title" style="display: none;">
          <span>基础设置</span>
        </div>
        <div style="display: none;">
          <el-form-item label="联系客服">
            <el-radio-group v-model="form.isCustomerservice" @change="changeAB">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，买家可在你勾选的页面通过客服入口与你取得联系。</div>
          </el-form-item>

          <el-form-item label="客服入口页面" v-if="form.isCustomerservice == 1">
            <el-checkbox style="display: block;" v-model="checkboxOne">商品详情页面</el-checkbox>
            <div class="font-normal1" v-if="checkboxOne == true">
              <el-radio-group v-model="form.customerserviceGoodsConfigMap.default" @change="changeA">
                <el-radio label="0">默认名称</el-radio>
                <el-radio label="1">自定义名称</el-radio>
              </el-radio-group>
              <el-input size="small" style="width: 100px;margin-left: 10px;" placeholder="4个字以内" maxlength="4"
                v-model="form.customerserviceGoodsConfigMap.label"
                :disabled="form.customerserviceGoodsConfigMap.default == 0 ? true : false"></el-input>
              <div class="font-normal1">默认名称为客服，可自定义，如：咨询客服。
                <el-link slot="reference" :underline="false" type="primary" style="font-size:12px;color: #1890FF;"
                  @click="kefu">查看案例</el-link>
              </div>
            </div>
            <el-checkbox v-model="checkboxTwo">订单详情页面</el-checkbox>
            <div class="font-normal1" v-if="checkboxTwo == true">
              <el-radio-group v-model="form.customerserviceOrderConfigMap.default" @change="changeB">
                <el-radio label="0">默认名称</el-radio>
                <el-radio label="1">自定义名称</el-radio>
              </el-radio-group>
              <el-input size="small" style="width: 100px;margin-left: 10px;" placeholder="4个字以内" maxlength="4"
                v-model="form.customerserviceOrderConfigMap.label"
                :disabled="form.customerserviceOrderConfigMap.default == 0 ? true : false"></el-input>
              <div class="font-normal1">默认名称为客服，可自定义，如：咨询客服。
                <el-link slot="reference" :underline="false" type="primary" style="font-size:12px;color: #1890FF;"
                  @click="kefuOrder">查看案例</el-link>
              </div>
            </div>
          </el-form-item>

          <el-form-item label="是否显示在我的页面显示VIP入口">
            <el-radio-group v-model="form.isVipMy">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，可在我的页面显示直播挂件。
            </div>
          </el-form-item>


          <el-form-item label="是否显示首页直播挂件">
            <el-radio-group v-model="form.liveBroadcastPendant">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，可在首页显示直播挂件。
            </div>
          </el-form-item>

          <el-form-item label="首页悬浮滚动栏">
            <el-radio-group v-model="form.homeIsSuspensionrolling">
              <el-radio label="1">展示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">开启悬浮滚动栏将在首页展示用户的购买行为。
            </div>
          </el-form-item>
          <el-form-item label="办卡会员设置">
            <el-radio-group v-model="form.isVip">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div style="width:220px">
              <el-select v-model="form.vipUid" placeholder="请选择vip" clearable size="small" v-if="form.isVip == 1"
                style="display: inline;">
                <el-option v-for="item in selectOptions" :key="item.levelId" :label="item.levelName"
                  :value="item.levelId" />
              </el-select>
            </div>

            <div class="font-normal">开启后，可在商品详情页展示。
              <el-popover placement="right" trigger="hover" style="font-size: 12px;">
                <div align="center">
                  <img style="width: 100%;height: 100%;" src="../../../assets/images/isVip.png" class="image-rows" />
                </div>
                <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
              </el-popover>
            </div>
          </el-form-item>
          <el-form-item label="是否开启短信登陆" v-if="0 > 1">
            <el-radio-group v-model="form.isShortMessage">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
          </el-form-item>

          <el-form-item label="热门搜索关键字">
            <el-tag :key="tag" v-for="tag in dynamicTags" closable :disable-transitions="false"
              @close="handleClose(tag)">
              {{ tag }}
            </el-tag>
            <el-input class="input-new-tag" v-if="inputVisible" v-model="inputValue" ref="saveTagInput" size="small"
              @keyup.enter.native="handleInputConfirm" @blur="handleInputConfirm">
            </el-input>
            <el-button v-else class="button-new-tag" size="small" @click="showInput">+ 新增</el-button>
          </el-form-item>

          <div class="div-title" style="border-radius: 4px">
            <span>商品设置</span>
          </div>

          <el-form-item label="店铺营销标签" v-if="0 > 1">
            <el-radio-group v-model="form.isMarketingtag">
              <el-radio label="1">显示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">展示后，在商品列表展示活动及优惠券信息。
              <el-popover placement="right" trigger="hover" style="font-size: 12px;">
                <div align="center">
                  <el-image src="https://b.yzcdn.cn/shop/atmosphere/marketing/show.png" align="center">
                  </el-image>
                </div>
                <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
              </el-popover>
            </div>
          </el-form-item>

          <el-form-item label="是否显示商品页直播挂件">
            <el-radio-group v-model="form.goodsLiveBroadcastPendant">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，可在商品页显示直播挂件。
            </div>
          </el-form-item>


          <el-form-item label="售罄商品">
            <el-radio-group v-model="form.isSellout">
              <el-radio label="1">显示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">展示后，售罄商品会在店铺中展示，并显示“已售罄”标记。</div>
          </el-form-item>

          <el-form-item label="售罄标识" style="margin-bottom: 10px;height: 170px;">
            <imageArray :imageStr.sync="form.selloutImg" :key="form.selloutImg" :msg="'图片要求：宽高相等，建议800px，大小1M内。'"
              :limit="1"></imageArray>
          </el-form-item>


          <el-form-item label="悬浮滚动栏">
            <el-radio-group v-model="form.isSuspensionrolling">
              <el-radio label="1">展示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">开启悬浮滚动栏将在商品详情页展示</div>
            <el-checkbox-group v-model="nrolling" v-if="form.isSuspensionrolling == 1" :min="1" @change="vs">
              <el-checkbox label="1">购买行为</el-checkbox>
              <el-checkbox label="2">收藏行为</el-checkbox>
              <el-checkbox label="3">评论行为</el-checkbox>
              <el-checkbox label="4">浏览行为</el-checkbox>
            </el-checkbox-group>
            <div class="font-normal" v-if="form.isSuspensionrolling == 1">勾选后，将在悬浮滚动栏中展示勾选的行为数据。选中“展示”后，至少选中一种行为。
              <el-popover placement="right" trigger="hover" style="font-size: 12px;width: 400%; height: 200%;">
                <div align="center">
                  <img style="width: 100%;height: 100%;" src="../../../assets/images/alert.png" class="image-rows" />

                </div>
                <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
              </el-popover>
            </div>
          </el-form-item>

          <el-form-item label="商品评论">
            <el-radio-group v-model="form.isGoodsComment">
              <el-radio label="1">显示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">展示后，评论将在商品详情页对买家进行展示。</div>
            <div v-if="form.isGoodsComment == 1">
              <div style="margin-top: 5px;font-size: 14px;color: #606266;">
                <el-checkbox v-model="checkboxThree"></el-checkbox>
                美容师评分星级大于等于
                <el-input size="small" style="width: 50px;margin-left: 5px;margin-right: 5px;" maxlength="1"
                  v-model="form.commentServiceMap.rate"
                  @input="form.commentServiceMap.rate = form.commentServiceMap.rate.replace(/^[^0-5]+/g, '')"
                  :disabled="!checkboxThree"></el-input>星显示
              </div>
              <div style="margin-top: 5px;font-size: 14px;color: #606266;">
                <el-checkbox v-model="checkboxFour"></el-checkbox>
                商品评分星级大于等于
                <el-input size="small" style="width: 50px;margin-left: 5px;margin-right: 5px;" maxlength="1"
                  v-model="form.commentProductMap.rate"
                  @input="form.commentProductMap.rate = form.commentProductMap.rate.replace(/^[^0-5]+/g, '')"
                  :disabled="!checkboxFour"></el-input>星显示
              </div>
              <div style="margin-top: 5px;font-size: 14px;color: #606266;">
                <el-checkbox v-model="checkboxFive"></el-checkbox>
                物流评分星级大于等于
                <el-input size="small" style="width: 50px;margin-left: 5px;margin-right: 5px;" maxlength="1"
                  v-model="form.commentLogisticsMap.rate"
                  @input="form.commentLogisticsMap.rate = form.commentLogisticsMap.rate.replace(/^[^0-5]+/g, '')"
                  :disabled="!checkboxFive">
                </el-input>星显示
              </div>
              <div class="font-normal">每个星级最大是5颗星</div>
            </div>
          </el-form-item>

          <el-form-item label="更多商品推荐">
            <el-radio-group v-model="form.isGoodsLike">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，可在你勾选的页面进行商品推荐。</div>
            <el-checkbox-group v-model="goodsLikeList" v-if="form.isGoodsLike == 1">
              <el-checkbox label="1">商品详情页</el-checkbox>
              <el-checkbox label="2">支付成功页</el-checkbox>
              <el-checkbox label="3">购物车页</el-checkbox>
            </el-checkbox-group>
            <el-checkbox-group v-model="goodsLikeList" v-if="0 > 1">
              <el-checkbox label="4">订单列表页</el-checkbox>
              <el-checkbox label="5">订单详情页</el-checkbox>
              <el-checkbox label="6">退款页面</el-checkbox>
            </el-checkbox-group>
          </el-form-item>

          <el-form-item label="商品详情页销量显示">
            <el-radio-group v-model="form.isGoodsSaleNumber" @change="changeC">
              <el-radio label="1">展示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">选择展示，商品详情页中将展示当前商品的销量。
            </div>
            <div v-if="form.isGoodsSaleNumber == 1">
              <div style="margin-top: 5px;font-size: 14px;color: #606266;">
                <el-checkbox v-model="checkboxSix"></el-checkbox>
                销量大于等于
                <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
                  v-model="form.goodsSaleNumberMap.number"
                  @input="form.goodsSaleNumberMap.number = form.goodsSaleNumberMap.number.replace(/^(0+)|[^\d]+/g, '')"
                  :disabled="!checkboxSix"></el-input>件时显示
              </div>
              <div class="font-normal">勾选后,商品销量达到设定值后将展示销量。
                <el-popover placement="right" trigger="hover" style="font-size: 12px;">
                  <div align="center" style="width: 271px; height: 400px;">
                    <el-image style="width: 100%;height: 100%;"
                      src="https://img.yzcdn.cn/public_files/2019/09/05/63407a1d45655528184c7662cec26f73.png">
                    </el-image>
                  </div>
                  <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
                </el-popover>
              </div>
            </div>
          </el-form-item>

          <el-form-item label="商品详情页属性显示">
            <el-radio-group v-model="form.isProperty">
              <el-radio label="1">展示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">开启“展示”后，则将在商品详情页展示属性参数。
              <el-popover placement="right" trigger="hover" style="font-size: 12px;">
                <div align="center">
                  <div style="display: inline-block;">
                    <img style="width: 322px;height: 554px;" src="../../../assets/images/product_property.png"
                      class="image-rows" />
                  </div>
                  <div style="margin-left: 10px;display: inline-block;">
                    <img style="width: 322px;height: 554px;" src="../../../assets/images/product_property_values.png"
                      class="image-rows" />
                  </div>
                </div>
                <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
              </el-popover>
            </div>
          </el-form-item>

          <el-form-item label="领券促销入口">
            <el-radio-group v-model="form.isCouponTags">
              <el-radio label="1">展示</el-radio>
              <el-radio label="0">隐藏</el-radio>
            </el-radio-group>
            <div class="font-normal">开启“展示”后，则将在商品详情页展示优惠券。
              <el-popover placement="right" trigger="hover" style="font-size: 12px;">
                <div align="center">
                  <img style="width: 100%;height: 100%;" src="../../../assets/images/product_coupon.png"
                    class="image-rows" />

                </div>
                <el-link slot="reference" :underline="false" style="font-size:12px;color: #1890FF;">查看案例</el-link>
              </el-popover>
            </div>
          </el-form-item>

          <el-form-item label="商品海报样式">
            <el-radio-group v-model="form.isGoodsPoster">
              <el-radio label="1">样式1</el-radio>
              <el-radio label="2">样式2</el-radio>
            </el-radio-group>
            <div class="font-normal">海报样式暂时仅对H5/小程序端生效
              <el-link slot="reference" :underline="false" type="primary" style="font-size:12px;color: #1890FF;"
                @click="kefu">查看案例</el-link>
            </div>

          </el-form-item>

          <el-form-item label="小程序分享样式">
            <el-radio-group v-model="form.isShare">
              <el-radio label="1">样式1</el-radio>
              <el-radio label="2">样式2</el-radio>
            </el-radio-group>
            <div>
              <el-link slot="reference" :underline="false" type="primary" style="font-size:12px;color: #1890FF;"
                @click="kefuOne">查看案例</el-link>
            </div>
            <div class="font-normal"></div>
          </el-form-item>


          <div class="div-title" style="border-radius: 4px">
            <span>订单设置</span>
          </div>

          <el-form-item label="1元多少积分" style="font-size: 14px;color:#606266 ;">
            商品卖出1元，就有
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.goodsIntegral">
            </el-input>积分
          </el-form-item>

          <el-form-item label="待付款订单取消时间" style="font-size: 14px;color:#606266 ;">
            拍下未付款订单
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.waitOrderPayment"
              @input="form.waitOrderPayment = form.waitOrderPayment.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>分钟内未付款，自动取消订单
          </el-form-item>

          <el-form-item label="已付款订单取消时间" style="font-size: 14px;color:#606266 ;">
            已付款订单
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.orderPayment" @input="form.orderPayment = form.orderPayment.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>分钟内可手动取消订单
          </el-form-item>

          <el-form-item label="已付款订单修改地址时间" style="font-size: 14px;color:#606266 ;">
            已付款订单
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.orderAddress" @input="form.orderAddress = form.orderAddress.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>分钟内可手动修改地址
          </el-form-item>

          <el-form-item label="收货后进行分润解冻的时间" style="font-size: 14px;color:#606266 ;">
            收货后
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.orderMoney" @input="form.orderMoney = form.orderMoney.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>天后，进行分润解冻
          </el-form-item>

          <el-form-item label="待付款订单催付弹窗">
            <el-radio-group v-model="form.isOrderPayment">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">开启后，当买家存在待付款订单时，进入店铺首页、商品详情页展示催付弹窗</div>
          </el-form-item>

          <el-form-item label="是否开发票">
            <el-radio-group v-model="form.isInvoice">
              <el-radio label="1">开启</el-radio>
              <el-radio label="0">关闭</el-radio>
            </el-radio-group>
            <div class="font-normal">关闭后，买家在提交订单页/订单详情页，无法填写发票信息，只能通过客服/电话联系商家处理。</div>
          </el-form-item>

          <el-form-item label="可开票的时间范围" style="font-size: 14px;color:#606266 ;" v-if="form.isInvoice == 1">
            下订单后可开票的时间范围
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.invoiceTime" @input="form.invoiceTime = form.invoiceTime.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>天内
          </el-form-item>

          <el-form-item label="供应商帐期" style="font-size: 14px;color:#606266 ;" v-if="form.isInvoice == 1">
            供应商帐期
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.supplierCheckOut"
              @input="form.supplierCheckOut = form.supplierCheckOut.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>天数
          </el-form-item>

          <el-form-item label="自动收货" style="font-size: 14px;color:#606266 ;">
            买家发货后
            <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;" maxlength="9"
              v-model="form.autoDate" @input="form.autoDate = form.autoDate.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>天自动收货,也可以再次延时 <el-input size="small" style="width: 100px;margin-left: 5px;margin-right: 5px;"
              maxlength="9" v-model="form.delayedDate"
              @input="form.delayedDate = form.delayedDate.replace(/^(0+)|[^\d]+/g, '')">
            </el-input>天，自动收货
          </el-form-item>


          <div class="div-title" style="border-radius: 4px">
            <span>售后设置</span>
          </div>
          <el-form-item label="售后说明" prop="orderService" style="    padding-bottom: 30px">
            <el-input :rows="5" type="textarea" placeholder="售后说明" v-model="form.orderService" style="width: 350px">
            </el-input>
          </el-form-item>


        </div>




      </el-form>

    </div>
    <el-dialog title="查看案例" :visible.sync="open" width="700px" append-to-body>
      <div style="width: 322px;height: 554px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          默认名称
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/kefu.png" class="image-rows" />

      </div>
      <div style="width: 322px;height: 554px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          自定义名称
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/kefu_custom.png"
          class="image-rows" />
      </div>
    </el-dialog>

    <el-dialog title="查看案例" :visible.sync="openOrder" width="700px" append-to-body>
      <div style="width: 322px;height: 554px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          默认名称
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/kefu_order.png"
          class="image-rows" />

      </div>
      <div style="width: 322px;height: 554px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          自定义名称
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/kefu_order_custom.png"
          class="image-rows" />
      </div>
    </el-dialog>


    <el-dialog title="查看案例" :visible.sync="openOne" width="580px" append-to-body>
      <div style="width: 258px;height: 259px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          样式一
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/shareOne.png"
          class="image-rows" />

      </div>
      <div style="width: 258px;height: 259px;display: inline-block;">
        <div style="font-size: 16px;font-weight: 600;width: 200px;margin-left: 10px;">
          样式二
        </div>
        <img style="width: 100%;height: 100%;padding: 5px;" src="../../../assets/images/shareTwo.png"
          class="image-rows" />
      </div>
    </el-dialog>

  </div>
</template>
<script>
import {
  listGeneralsettings,
  updateGeneralsettings

}
  from "@/api/platform/generalsettings";
import {
  getRegion
} from '@/api/common/regin'
import {
  getPayLevel
} from "@/api/customer/level";
import imageArray from "@/components/ImageUpload/imageArray";
export default {
  components: {
    imageArray
  },
  data() {
    return {
      dynamicTags: [],
      inputVisible: false,
      inputValue: '',
      open: false,
      openOrder: false,
      checkboxOne: false,
      checkboxTwo: false,
      checkboxThree: false,
      checkboxFour: false,
      checkboxFive: false,
      checkboxSix: false,
      oldform: {},
      openOne: false,
      nrolling: [],
      goodsLikeList: [],
      form: {
        customerserviceGoodsConfigMap: {
          default: 0
        },
        customerserviceOrderConfigMap: {
          default: 0
        },
        commentProductMap: {
          rate: ""
        },
        commentServiceMap: {
          rate: ""
        },
        commentLogisticsMap: {
          rate: ""
        },
        goodsSaleNumberMap: {
          number: ""
        },
        orderPayment: null,
        info: {
          platformName: ""
        }
      },
      rules: {
        platformName: [{
          required: true,
          message: "店铺不能为空",
          trigger: "blur"
        }],
        region: [{
          required: true,
          message: "店铺地址不能为空",
          trigger: "blur"
        }],
        mainCategory: [{
          required: true,
          message: "主营品类不能为空",
          trigger: "blur"
        }],
        platformEmail: [{
          type: "email",
          message: "'请输入正确的邮箱地址",
          trigger: ["blur", "change"]
        }],
        servePhone: [{
          required: true,
          pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
          message: "请输入正确的手机号码",
          trigger: ["blur", "change"]
        }]
      },
      selectOptions: [],
      codeOptions: [],
      options: [],
      region: [],
    };
  },
  created() {
    this.get();
    getPayLevel().then(response => {
      this.selectOptions = response;
    });
    this.getDicts("platform_trade_code").then(response => {
      this.codeOptions = response.data;
    });
    // 产地
    getRegion().then((response) => {
      this.options = response.data;
    });
  },
  methods: {
    vs(value) {
      console.log(value)
    },
    handleClose(tag) {
      this.dynamicTags.splice(this.dynamicTags.indexOf(tag), 1);
    },

    showInput() {
      this.inputVisible = true;
      this.$nextTick(_ => {
        this.$refs.saveTagInput.$refs.input.focus();
      });
    },

    handleInputConfirm() {
      let inputValue = this.inputValue;
      if (inputValue) {
        if (inputValue.indexOf(",") > -1) {
          this.$message.error("不能包含逗号");
          return false;
        }
        this.dynamicTags.push(inputValue);
      }
      this.inputVisible = false;
      this.inputValue = '';
    },
    kefu() {
      this.open = true;
    },
    kefuOrder() {
      this.openOrder = true;
    },
    kefuOne() {
      this.openOne = true;
    },
    get() {
      listGeneralsettings().then(response => {
        this.oldform = response.oldData;
        this.form = response.data;
        let dx = this.form;
        this.createCheckBox(dx);
        if (dx.hotSearchs) {
          this.dynamicTags = dx.hotSearchs;
        }
      })
    },
    submitForm() {
      let dx = this.form;
      let check = this.checkValue(dx);
      if (check == "1") {
        return false;
      }
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.options) {
            if (this.$refs['cascaderAddr'] != null) {
              let areaName = this.$refs['cascaderAddr'].getCheckedNodes()[0].pathLabels
              if (this.form.region) {
                this.form.platformProvince = areaName[0];
                this.form.platformCity = areaName[1];
                this.form.platformArea = areaName[2];
              }
            }
          }
          this.form.hotSearchs = this.dynamicTags
          if (this.checkboxThree == true) {
            this.form.commentServiceMap.show = "1"
          } else {
            this.form.commentServiceMap.show = "0"

          }
          if (this.checkboxFour == true) {
            this.form.commentProductMap.show = "1"
          } else {
            this.form.commentProductMap.show = "0"

          }
          if (this.checkboxFive == true) {
            this.form.commentLogisticsMap.show = "1"
          } else {
            this.form.commentLogisticsMap.show = "0"

          }
          if (this.nrolling.length == 0) {
            this.form.suspensionrollingBuy = "0";
            this.form.suspensionrollingComment = "0";
            this.form.suspensionrollingCollection = "0";
            this.form.suspensionrollingView = "0";

          }
          this.nrolling.forEach(nr => {
            if (nr == "1") {
              this.form.suspensionrollingBuy = "1";
            }
            if (nr == "2") {
              this.form.suspensionrollingComment = "1";
            }
            if (nr == "3") {
              this.form.suspensionrollingCollection = "1";
            }
            if (nr == "4") {
              this.form.suspensionrollingView = "1";
            }
          })




          updateGeneralsettings(this.form).then(response => {
            this.$message.success("修改成功!")
            this.get();
          })
        }
      });
    },
    changeAB(value) {
      if (value == 1) {
        this.form.customerserviceGoodsConfigMap.default = this.oldform.customerserviceGoodsConfigMap.default;
        if (this.oldform.customerserviceGoods == "1") {
          this.checkboxOne = true;
          this.form.customerserviceGoodsConfigMap.label = this.oldform.customerserviceGoodsConfigMap.label;
        } else {
          this.checkboxOne = false;
          this.changeA(0);
        }
        this.form.customerserviceOrderConfigMap.default = this.oldform.customerserviceOrderConfigMap.default;
        if (this.oldform.customerserviceOrder == "1") {
          this.checkboxTwo = true;
          this.form.customerserviceOrderConfigMap.label = this.oldform.customerserviceOrderConfigMap.label;
        } else {
          this.checkboxTwo = false;
          this.changeB(0);
        }
      }
    },
    changeA(value) {
      if (value == 0) {
        this.form.customerserviceGoodsConfigMap.label = "";
      }
    },
    changeB(value) {
      if (value == 0) {
        this.form.customerserviceOrderConfigMap.label = "";
      }
    },
    changeC(value) {
      if (value == 0) {
        this.form.goodsSaleNumberMap.number = "";
        this.checkboxSix = false;
      }
    },
    checkValue(dx) {
      // 数据校验

      if (dx.isCustomerservice == "1") {
        if (dx.customerserviceGoods == "1") {
          if (dx.customerserviceGoodsConfigMap.default == "1") {
            if (dx.customerserviceGoodsConfigMap.label == "") {
              this.$message.error("请填写自定义名称！")
              return 1;
            }
          }
        }
        if (dx.customerserviceOrder == "1") {
          if (dx.customerserviceOrderConfigMap.default == "1") {
            if (dx.customerserviceOrderConfigMap.label == "") {
              this.$message.error("请填写自定义名称！")
              return 1;
            }
          }
        }
      }
      if (dx.isVip == "1") {
        if (dx.vipUid == "") {
          this.$message.error("请选择VIP！")
          return 1;
        }
      }
      if (dx.platformLogUrl == "") {
        this.$message.error("请上传店铺logo！")
        return 1;
      }

      if (dx.isGoodsComment == "1") {
        if (dx.commentServiceMap.show == "1") {
          if (dx.commentServiceMap.rate == "") {
            this.$message.error("请填写服务评星！")
            return 1;
          }
        }
        if (dx.commentProductMap.show == "1") {
          if (dx.commentProductMap.rate == "") {
            this.$message.error("请填写商品评星！")
            return 1;
          }
        }
        if (dx.commentLogisticsMap.show == "1") {
          if (dx.commentLogisticsMap.rate == "") {
            this.$message.error("请填写物流评星！")
            return 1;
          }
        }
      }
      if (dx.waitOrderPayment == "") {
        this.$message.error("请填写待付款自动取消时间！")
        return 1;
      }
      if (dx.orderPayment == "") {
        this.$message.error("请填写付款可手动取消时间！")
        return 1;
      }
      if (dx.orderAddress == "") {
        this.$message.error("请填写付款后可手动修改地址的时间！")
        return 1;
      }
      if (dx.orderMoney == "") {
        this.$message.error("请填写收货后，分润的解冻时间！")
        return 1;
      }
      if (dx.goodsIntegral == "") {
        this.$message.error("请填写1元等于多少积分！")
        return 1;
      }
      return 0;
    },
    createCheckBox(dx) {
      if (dx.customerserviceGoods == "1") {
        this.checkboxOne = true;
      }
      if (dx.customerserviceOrder == "1") {
        this.checkboxTwo = true;
      }
      this.nrolling = [];
      if (dx.isSuspensionrolling == "1") {
        if (dx.suspensionrollingBuy == "1") {
          this.nrolling.push("1")
        } else {
          //this.nrolling.push("0")
        }
        if (dx.suspensionrollingComment == "1") {
          this.nrolling.push("2")
        } else {
          //this.nrolling.push("0")
        }
        if (dx.suspensionrollingCollection == "1") {
          this.nrolling.push("3")
        } else {
          //this.nrolling.push("0")
        }
        if (dx.suspensionrollingView == "1") {
          this.nrolling.push("4")
        } else {
          //this.nrolling.push("0")
        }
      }
      if (dx.commentServiceMap.show == "1") {
        this.checkboxThree = true;
      }
      if (dx.commentProductMap.show == "1") {
        this.checkboxFour = true;
      }
      if (dx.commentLogisticsMap.show == "1") {
        this.checkboxFive = true;
      }
      if (dx.goodsLikeGoods == "1") {
        this.goodsLikeList.push("1")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.goodsLikeBuy == "1") {
        this.goodsLikeList.push("2")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.goodsLikeCart == "1") {
        this.goodsLikeList.push("3")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.goodsLikeOrderDetail == "1") {
        this.goodsLikeList.push("4")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.goodsLikeOrderDetails == "1") {
        this.goodsLikeList.push("5")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.goodsLikeRefund == "1") {
        this.goodsLikeList.push("6")
      } else {
        this.goodsLikeList.push("0")
      }
      if (dx.isGoodsSaleNumber == 1) {
        checkboxSix = true;
      }

    }
  }
};
</script>

<style scoped>
.el-tag+.el-tag {
  margin-left: 10px;
}

.button-new-tag {
  margin-left: 10px;
  height: 32px;
  line-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}

.input-new-tag {
  width: 90px;
  margin-left: 10px;
  vertical-align: bottom;
}

.block {
  padding: 30px 0;
  text-align: center;
  display: inline-block;
  vertical-align: top;
}

.app-container {
  background-color: #F7F8FA;
  padding: 20px;
}

.font-normal1 {
  font-size: 12px;
  color: #84868a;
  margin-top: -5px;
}

.font-normal {
  font-size: 12px;
  color: #84868a;
  margin-top: -6px;
}

.div-title {
  background-color: rgb(242, 246, 252);
  margin: 15px;
  padding: 10px 10px 10px 10px;
  font-weight: 500;
}

.dw {
  z-index: 2000;
  border: 1px;
  position: fixed;
  bottom: 0px;
  background-color: #f7f8fa;
  width: 100%;
  height: 55px;
}
</style>
